package com.googlecode.imanager;

import java.io.OutputStream;

import com.googlecode.imanager.client.Application;
import com.googlecode.imanager.client.Document;
import com.googlecode.imanager.client.bridge.BridgeManager;
import com.googlecode.imanager.client.bridge.BridgeType;
import com.googlecode.imanager.client.exception.IMException;

/**
 * @author wellsantos@wellsantos.com
 * @since 0.01
 */
public class InterfaceManager {

    private static final InterfaceManager instance = new InterfaceManager();
    
    private InterfaceManager() {
    }
    
    public static InterfaceManager getInstance(){
        return instance;
    }
    
    public void generateSwing(Application application) throws IMException {
        BridgeManager.getInstance().generateBridge(application, BridgeType.SWING, null);
    }
    
    public Application generateSwing(Document document) throws IMException {
        BridgeManager.getInstance().generateBridge(document, BridgeType.SWING, null);
        return document.getApplication();
    }
    
    public void generatePdf(Document document, OutputStream output) throws IMException {
        BridgeManager.getInstance().generateBridge(document, BridgeType.PDF, output);
    }
    
    public void generateXls(Document document, OutputStream output) throws IMException {
        BridgeManager.getInstance().generateBridge(document, BridgeType.XLS, output);
    }
    
/*    
    public abstract byte[] exportTo(String extension, Map<String, Object> params);
    
    public byte[] exportToXML(Map<String, Object> params) {
        return exportTo("xml", params);
    }
    
    public byte[] exportToHTML(Map<String, Object> params) {
        return exportTo("html", params);
    }
    
    public byte[] exportToPDF(Map<String, Object> params) {
        return exportTo("pdf", params);
    }
    
    public byte[] exportToXLS(Map<String, Object> params)  {
        return exportTo("xls", params);
    }
    
    public byte[] exportToDOC(Map<String, Object> params) {
        return exportTo("doc", params);
    }
    
    public byte[] exportToRTF(Map<String, Object> params) {
        return exportTo("rtf", params);
    }
    
    public byte[] exportToODF(Map<String, Object> params) {
        return exportTo("odf", params);
    }
    
    public byte[] exportToTXT(Map<String, Object> params) {
        return exportTo("txt", params);
    }
    
    public byte[] exportToCSV(Map<String, Object> params) {
        return exportTo("csv", params);
    }
*/    
}
